Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports DotNetNuke
Namespace NVPortal.Modules.NVNews

    Public MustInherit Class Incentra_news
        Inherits Entities.Modules.PortalModuleBase

#Region "Controls"
#End Region

#Region "Event Handlers"
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Try
                If Not IsPostBack Then
                    BindDataa()
                End If
            Catch ex As Exception
                'Me.imgNews.Visible = False
                ' Exception
                ProcessModuleLoadException(Me, ex)
            End Try
        End Sub
        Sub BindDataa()
            Dim DisplayNumber As String
            If Settings("NVNewsDisplayNumberSetting") <> "" Then
                DisplayNumber = Settings("NVNewsDisplayNumberSetting")
            Else
                DisplayNumber = "1" ' 1 row and 1 col
            End If
            'Cac tin khac cung chuyen muc voi tin nay
            Dim arrNews As New ArrayList
            Dim ctlNews As New NV_NewsController
            arrNews = ctlNews.SelectCustomeNews(IIf(Settings("NVNewsCategorySetting") <> "", Settings("NVNewsCategorySetting"), 0), PortalId, CInt(DisplayNumber) + 1)
            Me.drgOtherNews.DataSource = arrNews
            Me.drgOtherNews.DataBind()
            Me.drgOtherNews.HeaderRow.Visible = False
        End Sub
        Public Function ReplaceChuoi(ByVal chuoi As String) As String
            Dim convert As String = Global.ReplaceChuoi.bodau(chuoi).Replace(" ", "-")
            Return convert
        End Function
        Protected Sub drgOtherNews_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles drgOtherNews.PageIndexChanging
            drgOtherNews.PageIndex = e.NewPageIndex
            BindDataa()
        End Sub
        Public Function FormatURL(ByVal strID As String, ByVal strLink As String) As String
            Return "/" & Settings("NVNewsDisplayPageSetting") & "/" & strID & "/" & ReplaceChuoi(strLink) & ".htm"
        End Function

#End Region

#Region "Optional Interfaces"

#End Region


    End Class

End Namespace
